package com.ruoze.bdp.dao;

import com.ruoze.bdp.entity.ClusterEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface IClusterRepository extends Repository<ClusterEntity,Long>,
        JpaRepository<ClusterEntity,Long>, JpaSpecificationExecutor<ClusterEntity> {

    @Modifying
    @Transactional
    @Query("update #{#entityName} d set d.status = 1 where d.id = ?1")
    void logicalDeleteById(Long Id);

    @Modifying
    @Transactional
    @Query("update #{#entityName} d set d.status = 1 where d.id in (?1)")
    void logicalDeleteBatch(List<Long> ids);
}
